$(document).ready(function(){	
	$("#addUser").val(username);
	//下拉初始化
	InitchannelId();
	
});


//初始化下拉列表
function InitchannelId()
{
	
	$.ajax({
		url:server_url+'/rest/Channel/selectChannel.do?ran='+Math.random()+"&token="+token,
		type:'get',
		success:function(data){
			if(data.retCode=="0000"){
				for(var i=0;i<data.data.length;i++){
					$("#channelId").append("<option value='"+data.data[i].id+"'>"+data.data[i].channelName+"</option>");
				}
			}
			else{
				easyDialog.open({
					  container : {
						  header : '提示',
					      content : data.retMsg
					  },
					  autoClose : 2000
					});				
			} 			
		}
	});	
}

function back(){
	
	var url="getChannelPRListPage.do?ran="+Math.random();
	tl_config.loadToWorkArea(url);
}

function submitCommit(){	
	$.ajax({
		url:server_url+'/rest/ChannelPR/ChannelPRAdd.do?ran='+Math.random()+ '&token=' + token,
		type:'post',
		data:$("#fromChannelPRAdd").serialize(),
		success:function(data){
			easyDialog.open({container:{header:'温馨提示',content:data.retMsg},autoClose : 2000});
			back();
		}
	});
}
